<%--
  - Author		:	이 영호(Youngho Lee)	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});
		</script>
	</head>
	<body>
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="contMenuTitle">
					<img src="<c:url value="${dirImages}/subtit_03.gif" />" title="검증 결과 조회" alt="검증 결과 조회">
				</div>
				<div class="secTitle">
					<img src="<c:url value="${dirImages}/icon.png" />" title="검증결과" alt="검증결과" > 
					<c:choose>
						<c:when test="${param.type eq 'pay'}">
							결제기 검증
						</c:when>
						<c:otherwise>
							애플릿 검증
						</c:otherwise>
					</c:choose>
				</div>
				<table class="formTbl">
					<colgroup>
						<col width="130px">
						<col width="*">
						<col width="130px">
						<col width="*">
					</colgroup>
					<tbody>
						<tr>
							<th>신청기관명</th>
							<td>${vertification.bizName}</td>
							<th>검증분야</th>
							<td>
								<c:choose>
									<c:when test="${vertification.type eq 1}">애플릿 검증</c:when>
									<c:when test="${vertification.type eq 2}">결제기 검증</c:when>
									<c:otherwise>
										${vertification.type}
									</c:otherwise>
								</c:choose>
							</td>
						</tr>
						<tr>
							<th>신청자 ID</th>
							<td>${vertification.createdId}</td>
							<th>기간</th>
							<td>
								<c:catch var="e">
									<fmt:parseDate var="createdTime" pattern="yyyy-MM-dd HH:mm:ss" value="${vertification.createdTime}" />
									<fmt:formatDate value="${createdTime}" pattern="yyyy.MM.dd" />
								</c:catch>
								<c:if test="${not empty e}">
									${vertification.createdTime}
								</c:if>
							</td>
						</tr>
						<tr>
							<th>검증단계</th>
							<td>
								<%-- 검증 상태 (-1:오류, 0:검증 신청, 1:진행중, 2:성공) --%>
								<c:choose>
									<c:when test="${vertification.status eq -1}">검증 오류</c:when>
									<c:when test="${vertification.status eq 0}">검증 신청</c:when>
									<c:when test="${vertification.status eq 1}">검증 중</c:when>
									<c:when test="${vertification.status eq 2}">검증 완료</c:when>
									<c:otherwise>
										${vertification.status}
									</c:otherwise>
								</c:choose>
							</td>
							<th>애플릿의 AID</th>
							<td>${vertification.aid}</td>
						</tr>
						<tr>
							<th>CAP 파일 업로드</th>
							<td>
								<fmt:message key="file.capFile.viewUrl" var="viewUrl" />
								<a href="${vertification.cap}" target="_blank">${fn:replace(vertification.cap, viewUrl, '')}</a>
							</td>
							<th>테스트 단말 선택</th>
							<td>${vertification.testDevice}</td>
						</tr>
					</tbody>
				</table>
				<table class="formTbl" style="margin-top: 10px;">
					<colgroup>
						<col width="130px">
						<col width="*">
					</colgroup>
					<tbody>
						<tr>
							<th>검증로그</th>
							<td>
								<textarea style="width: 585px; height: 160px; margin: 5px 0; border: none;">${vertification.log}</textarea>
							</td>
						</tr>
						<tr>
							<th>분석의견</th>
							<td>
								<textarea style="width: 585px; height: 160px; margin: 5px 0; border: none;">${vertification.opinion}</textarea>
							</td>
						</tr>
					</tbody>
				</table>
				<div class="btnWrap rightBtnWrap">
					<c:if test="${not empty vertification.testResultFile}">
						<a href="${vertification.testResultFile}" target="blank">
							<input type="button"  class="btn btn_test_down" alt="테스트 결과서 다운로드" title="테스트 결과서 다운로드">
						</a>
					</c:if>
					<input type="button" class="btn btn_retestify" alt="재검증 신청" title="재검증 신청" onclick="javascript:document.reqFrm.submit();">
				</div>
				<br />
				<div class="secTitle">
					<img src="<c:url value="${dirImages}/icon.png" />" title="검증이력" alt="검증이력" > 검증이력
				</div>
				<table class="listTbl linked">
					<thead>
						<tr>
							<th>신청일자</th>
							<th>신청기관</th>
							<th>신청ID</th>
							<th>애플릿 AID</th>
							<th>애플릿 발급단계</th>
							<th>CAP 파일</th>
							<th>TEST 단말 선택</th>
							<th class="lastTh">접수 상태</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${vertificationHistory}" var="vHistory">
							<tr>
								<td>
									<c:catch var="e">
										<fmt:parseDate var="createdTime" pattern="yyyy-MM-dd HH:mm:ss" value="${vHistory.createdTime}" />
										<fmt:formatDate value="${createdTime}" pattern="yyyy.MM.dd" />
									</c:catch>
									<c:if test="${not empty e}">
										${vHistory.createdTime}
									</c:if>
								</td>
								<td>${vHistory.bizName}</td>
								<td>${vHistory.createdId}</td>
								<td>${vHistory.aid}</td>
								<td>
									<%-- 검증 상태 (-1:오류, 0:검증 신청, 1:진행중, 2:성공) --%>
									<c:choose>
										<c:when test="${vHistory.status eq -1}">검증 오류</c:when>
										<c:when test="${vHistory.status eq 0}">검증 신청</c:when>
										<c:when test="${vHistory.status eq 1}">검증 중</c:when>
										<c:when test="${vHistory.status eq 2}">검증 완료</c:when>
										<c:otherwise>
											${vHistory.status}
										</c:otherwise>
									</c:choose>
								</td>
								<td><a href="${vHistory.cap}" target="_blank">CAP 파일 다운로드</a></td>
								<td>${vHistory.testDevice}</td>
								<td><img class="btn"  src="<c:url value="${dirImages}/icon_ing.gif" />" title="처리중" alt="처리중" /></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
		<c:choose>
			<c:when test="${vertification.type eq 1}"><c:set var="reqFrmActionUrl" value="/request/applet.do" /></c:when>
			<c:when test="${vertification.type eq 2}"><c:set var="reqFrmActionUrl" value="/request/pay.do" /></c:when>
		</c:choose>
		<form name="reqFrm" method="post" action="<c:url value="${reqFrmActionUrl}" />" style="display: none;">
			<input type="hidden" name="fAct" value="modify" />
			<input type="hidden" name="idx" value="${vertification.idx}" />
		</form>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
	</body>
</html> 